import request from '@/utils/request'
// import axios from 'axios'
import { apiVersion } from '@/config'
// import { getDeviceId } from '@/utils/tool'


// 获取详情
export function organizationDetail(data) {
    return request({
        url: `/user/${apiVersion}/organization/${data.id}`,
        method: 'get',
        data
    })
}

// 分页列表
export function organizationLis(data) {
    return request({
        url: `/user/${apiVersion}/organization`,
        method: 'get',
        data
    })
}
// 查询列表
export function organizationAll(data) {
    return request({
        url: `/user/${apiVersion}/organization/all`,
        method: 'get',
        data
    })
}
// 创建机构
export function addOrganization(data) {
    return request({
        url: `/user/${apiVersion}/organization`,
        method: 'post',
        data
    })
}
// 修改机构
export function putOrganization(data) {
    return request({
        url: `/user/${apiVersion}/organization`,
        method: 'put',
        data
    })
}
// 删除用户
export function delOrganizationr(data) {
    return request({
        url: `/user/${apiVersion}/organization/${data.id}`,
        method: 'delete',
        data
    })
}
// 禁用用户
export function disableOrganizationr(data) {
    return request({
        url: `/user/${apiVersion}/organization/disable/${data.id}`,
        method: 'put',
        data
    })
}
// 获取加入机构的用户
export function organizationUserAll(data) {
    return request({
        url: `/user/${apiVersion}/organizationUser/all`,
        method: 'get',
        data
    })
}
// 用户加入机构
export function addOrganizationUser(data) {
    return request({
        url: `/user/${apiVersion}/organizationUser`,
        method: 'post',
        data
    })
}
// 设置用户在机构内的角色
export function putOrganizationUser(data) {
    return request({
        url: `/user/${apiVersion}/organizationUser`,
        method: 'put',
        data
    })
}
// 机构删除用户
// export function delOrganizationUser(data) {
//     return request({
//         url: `/user/${apiVersion}/organizationUser/${data.id}`,
//         method: 'delete',
//         data
//     })
// }
// 获取机构分配的资源组
export function organizationProductAll(data) {
    return request({
        url: `/admin/${apiVersion}/organizationProduct/all`,
        method: 'get',
        data
    })
}
// 资源组加入机构
export function addOrganizationProduct(data) {
    return request({
        url: `/admin/${apiVersion}/organizationProduct`,
        method: 'post',
        data
    })
}
// 机构删除资源组
export function delOrganizationProduct(data) {
    return request({
        url: `/admin/${apiVersion}/organizationProduct/${data.id}`,
        method: 'delete',
        data
    })
}

// 获取机构配额详情
export function organizationConfigurationDetail(data) {
    return request({
        url: `/admin/${apiVersion}/organizationConfiguration/${data.id}`,
        method: 'get',
        data
    })
}

// 机构配额分页列表
export function organizationConfigurationLis(data) {
    return request({
        url: `/admin/${apiVersion}/organizationConfiguration`,
        method: 'get',
        data
    })
}
// 修改机构配额
export function putOrganizationConfiguration(data) {
    return request({
        url: `/admin/${apiVersion}/organizationConfiguration`,
        method: 'put',
        data
    })
}

// 获取角色权限
export function getUserRbacRole() {
    return request({
        url: `/admin/${apiVersion}/rbac/role/all`,
        method: 'get',
    })
}

// 资源组加入机构
export function adduserRole(data) {
    return request({
        url: `/admin/${apiVersion}/rbac/userRole`,
        method: 'post',
        data
    })
}

// 获取机构配额详情
export function getuserRoleDetail(data) {
    return request({
        url: `/admin/${apiVersion}/rbac/userRole/all`,
        method: 'get',
        data
    })
}

// 机构删除用户
export function delOrganizationUser(data) {
    return request({
        url: `/admin/${apiVersion}/rbac/userRole/${data.id}`,
        method: 'delete',
        data
    })
}



